
* Table 1 in the manuscript, Figure 1 and Table 2 in Appendix C, and in-text numbers on p.7 in Appendix C

* Basics
clear all
set matsize 11000

* Set working directory
cd ""

* Import data
use articles_coding.dta, clear

* Figure 1, Appendix C
count if Simulation == "Yes"
count if  Bias == "Yes"
count if SD == "Yes"
count if OptimismOverconfidence == "Yes" | OptimismOverconfidence == "Yes/No"
count if RMSEMSE == "Yes"
count if CovType1 == "Yes"| CovType1 == " Yes"
count if PowerTypeIIerror == "Yes"


* Creating inputs for the tables
tab Bias
gen Bias_m=.
replace Bias_m=1 if Bias=="Yes"

tab2 Bias Bias_m, missing

tab RMSEMSE
gen RMSEMSE_m=.
replace RMSEMSE_m=1 if RMSEMSE=="Yes"

tab2 RMSEMSE RMSEMSE_m, missing

tab PowerTypeIIerror, gen(power)

gen PowerTypeIIerror_m=.
replace PowerTypeIIerror_m=1 if power3==1
replace PowerTypeIIerror_m=1 if power4==1

tab2 PowerTypeIIerror PowerTypeIIerror_m, missing

tab TypeIerror, missing
gen TypeIerror_m=.
replace TypeIerror_m=1 if TypeIerror=="Yes"

tab2 TypeIerror TypeIerror_m, missing

tab Coverage, missing
gen Coverage_m=.
replace Coverage_m=1 if Coverage=="Yes"

tab2 Coverage Coverage_m, missing

tab CovType1, missing
gen CovType1_m=.
replace CovType1_m=1 if CovType1=="Yes"

tab2 CovType1 CovType1_m, missing

tab SD, missing
gen SD_m=.
replace SD_m=1 if SD=="Yes"

tab2 SD SD_m, missing

tab OptimismOverconfidence, missing
gen OptimismOverconfidence_c=0
replace OptimismOverconfidence_c=1 if OptimismOverconfidence=="Yes"
replace OptimismOverconfidence_c=1 if OptimismOverconfidence=="Yes/No"

tab2 OptimismOverconfidence_c OptimismOverconfidence, missing
tab OptimismOverconfidence, missing
gen OptimismOverconfidence_m=.
replace OptimismOverconfidence_m=1 if OptimismOverconfidence_c==1

tab Bias
gen Bias_c=0
replace Bias_c=1 if Bias=="Yes"

tab2 Bias Bias_c, missing

tab RMSEMSE
gen RMSEMSE_c=0
replace RMSEMSE_c=1 if RMSEMSE=="Yes"

tab2 RMSEMSE RMSEMSE_c, missing

tab PowerTypeIIerror, gen(powerc)

gen PowerTypeIIerror_c=0
replace PowerTypeIIerror_c=1 if powerc3==1
replace PowerTypeIIerror_c=1 if powerc4==1

tab2 PowerTypeIIerror PowerTypeIIerror_m, missing

tab TypeIerror, missing
gen TypeIerror_c=0
replace TypeIerror_c=1 if TypeIerror=="Yes"

tab2 TypeIerror TypeIerror_c, missing

tab Coverage, missing
gen Coverage_c=0
replace Coverage_c=1 if Coverage=="Yes"

tab2 Coverage Coverage_c, missing

tab CovType1, missing
gen CovType1_c=0
replace CovType1_c=1 if CovType1=="Yes"

tab2 CovType1 CovType1_c, missing

tab SD, missing
gen SD_c=0
replace SD_c=1 if SD=="Yes"

tab2 SD SD_c, missing

* Appendix C numbers for in-text percentile range and density plots on p.7
tab DensityPlot, missing // Percent yes = 23.94
tab PercentileRange, missing // Percent unsure + yes = 18.31


* Table 1 in the manuscript and Table 2 in Appendix C
misschk Bias_m RMSEMSE_m CovType1_m SD_m OptimismOverconfidence_m PowerTypeIIerror_m, gen(miss6)
tab miss6pattern, sort


**** To get the frequencies for the bottom of the tables :
tab Bias_c
tab RMSEMSE_c
tab CovType1_c 
tab SD_c
tab OptimismOverconfidence_c
tab PowerTypeIIerror_c


